home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / JFC.bin / SingleSelectionModel.java < prev    next >
Text File  |  1998-06-30  |  2KB  |  68 lines

  1. /*
  2.  * %W% %E%
  3.  *
  4.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  *
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  *
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  *
  19.  */
  20.  
  21. package com.sun.java.swing;
  22.  
  23. import com.sun.java.swing.event.*;
  24.  
  25. /**
  26.  * A model that supports at most one indexed selection.
  27.  *
  28.  * @version %I% %G%
  29.  * @author Dave Moore
  30.  */
  31. public interface SingleSelectionModel {
  32.     /**
  33.      * @return  the model's selection, or -1 if there is no selection.
  34.      * @see     #setSelectedIndex
  35.      */
  36.     public int getSelectedIndex();
  37.  
  38.     /**
  39.      * Sets the model's selected index to <I>index</I>.
  40.      *
  41.      * Notifies any listeners if the model changes
  42.      *
  43.      * @see   #getSelectedIndex
  44.      * @see   #addChangeListener
  45.      */
  46.     public void setSelectedIndex(int index);
  47.  
  48.     /**
  49.      * Clears the selection (to -1).
  50.      */
  51.     public void clearSelection();
  52.  
  53.     /**
  54.      * Returns true if the selection model currently has a selected value.
  55.      */
  56.     public boolean isSelected();
  57.  
  58.     /**
  59.      * Adds <I>listener</I> as a listener to changes in the model.
  60.      */
  61.     void addChangeListener(ChangeListener listener);
  62.  
  63.     /**
  64.      * Removes <I>listener</I> as a listener to changes in the model.
  65.      */
  66.     void removeChangeListener(ChangeListener listener);
  67. }
  68.